package com.xyh.transaction.controller;

import com.xyh.transaction.entity.vo.StatisticVo;
import com.xyh.transaction.entity.vo.TabVo;
import com.xyh.transaction.response.ResponseResult;
import com.xyh.transaction.service.StatisticService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "数据统计管理")
@RestController
@RequestMapping("statistic")
public class StatisticController {

    @Autowired
    private StatisticService statisticService;


    @ApiOperation(value = "返回数据统计结果", notes = "返回当前登录用户相关商品统计数据")
    @GetMapping("goods")
    public ResponseResult<StatisticVo> goodsStatistic(@RequestParam Integer tab){
        StatisticVo statisticVo = statisticService.getStatistic(tab);
        return ResponseResult.success("查询成功！",statisticVo);
    }

    @ApiOperation(value = "标签页",notes = "返回数据统计页标签页列表")
    @GetMapping("tab")
    public ResponseResult<List<TabVo>> getTabList(){
        List<TabVo> tabList = statisticService.getTabList();
        return ResponseResult.success("查询成功！",tabList);
    }


}
